
import { _polar } from '../index.js'
// 螺旋线点
export const spiralPoints = (options) => {
    let {
        o = [0, 0],
        r = 10,
        n = 6,
        a = 0,
        m = 10
    } = options
    let a1 = a, a2 = 360 + a1
    return Array.from({ length: m }, (_, j) => {
        return Array.from({
            length: n
        }, (_, i) => {
            let a = a1 + i * (a2 - a1) / n
            return _polar(o, r * (j + 1) + r * i / n, a)
        })
    })
}

// 环形
export const ringPoints = (options) => {
    let {
        o = [0, 0],
        r = 10,
        n = 6,
        a = 0,
        m = 10
    } = options
    let a1 = a, a2 = 360 + a1
    return Array.from({ length: m }, (_, j) => {
        let r2 = r * (j + 1)
        return Array.from({
            length: n
        }, (_, i) => {
            let a = a1 + i * (a2 - a1) / n
            return _polar(o, r2, a)
        })
    })
}

// 射线

export const rayPoints = (options) => {
    let {
        o = [0, 0],
        r = 10,
        n = 6,
        a = 0,
        m = 10
    } = options
    let a1 = a, a2 = 360 + a1
    return Array.from({ length: n }, (_, j) => {
        let a = a1 + j * (a2 - a1) / n
        return Array.from({
            length: m
        }, (_, i) => {
            let r2 = r * (i + 1)
            return _polar(o, r2, a)
        })
    })
}
